namespace login{
    const R = require('../common/baseController')
    const {login, regist} = require('@/service/common/loginService')
    
    class LoginController{
        async login(ctx: any){
            ctx.verifyParams({
                name: {type: 'string', required: true},
                password: {type: 'string', required: true}
            })
            const loginInfo = await login(ctx)
            ctx.body =  R.ok(loginInfo)
        }
        async regist(ctx: any){
            ctx.verifyParams({
                name: {type: 'string', required: true},
                password: {type: 'string', required: true}
            })
            const registInfo = await regist(ctx)
            ctx.body = R.ok(registInfo)
        }
    }
    
    module.exports = new LoginController()
}